#ifndef NETWORKAVDATAREAD_H
#define NETWORKAVDATAREAD_H

#include <Task_Base/Task_Base.h>
#include <ClientImpl/Receive_handler.h>
#include "mainwindow.h"
#include <Task_Base/CriticalSection.h>
class AudioTask;
class SynchronousAV;
class VideoTask;
class AVCodecContext;
class AVFormatContext;

class NetworkAvDataRead : public Task_Base,public Receive_handler
{
public:
    NetworkAvDataRead(MainWindow &);
    ~NetworkAvDataRead();

    int AvWidth(){return  nWidth;}

    int Avheight(){return  nHeight;}

public:
    virtual int svc();//主动工作线程函数

    virtual int close();

    virtual bool receive_handler(char *data,int size);

    int RecvBuffer(uint8_t *buf, int buf_size);
private:
    CCriticalSection oCriSection;

    std::string  m_InPut_buf;

    AVFormatContext * pFormatCtx;

    MainWindow *m_pWnd;

    unsigned char *aviobuffer;

    int    bExit;

    int nWidth;

    int nHeight;
};

#endif // NETWORKAVDATAREAD_H
